import { GTileList } from "../../../../../com/mui/controls/GTileList";
import { ScrollBarDirection } from "../../../../../fl/controls/ScrollBarDirection";
import { BuyAndUsePropsRender } from "../BuyAndUsePropsRender";
import { DataProvider } from "../../../../../fl/data/DataProvider";
import { Cache } from "../../../cache/Cache";
import { ShopConfig } from "../../../resource/ShopConfig";
import { ECategory } from "../../../../../Message/Public/ECategory";
import { EProp } from "../../../../../Message/Public/EProp";
import { EPrictUnit } from "../../../../../Message/Public/EPrictUnit";
import { GameDefConfig } from "../../../resource/GameDefConfig";
import { ShopType } from "../../../resource/info/ShopType";
type int = number;
//class AcupointBuyNimbusProp
    
    export  class AcupointBuyNimbusProp extends GTileList
    {
        constructor()
        {
            super();
            mouseChildren = true;
            this.init();
            return;
        }

        /* internal  */init(): void
        {
            setSize(200, 270);
            columnWidth = 197;
            rowHeight = 77;
            direction = ScrollBarDirection.VERTICAL;
            verticalGap = 8;
            setStyle("skin", new Object /* flash.display.Bitmap */());
            setStyle("cellRenderer", BuyAndUsePropsRender);
            this.getProvider();
            return;
        }

        /* internal  */getProvider(): void
        {
            var loc3=null;
            var loc4=null;
            var loc5=null;
            var loc6=null;
            var loc7=null;
            var loc8=0;
            var loc9=0;
            var loc1=new DataProvider();
            var loc2=this.getNimbusInfoArray(AcupointBuyNimbusProp.NormalShopCode);
            if (Cache.instance.vip.isVIP) 
            {
                loc4 = this.getNimbusInfoArray(AcupointBuyNimbusProp.VipShopCode);
                loc8 = 0;
                while (loc8 < loc2.length) 
                {
                    loc3 = loc2[loc8];
                    loc6 = loc3.itemInfo.item;
                    loc9 = 0;
                    while (loc9 < loc4.length) 
                    {
                        loc7 = (loc5 = loc4[loc9]).itemInfo.item;
                        if (loc6.effect == loc7.effect && loc6.effectEx == loc7.effectEx) 
                        {
                            loc2.splice(loc8, 1);
                        }
                        ++loc9;
                    }
                    ++loc8;
                }
                var loc10=0;
                var loc11=loc4;
                for(loc5 of loc11) 
                {
                    loc2.push(loc5);
                }
            }
            loc10 = 0;
            loc11 = loc2;
            for(loc3 of loc11) 
            {
                loc1.addItem({"shopItemInfo": loc3, "isHot": this.isHot});
            }
            dataProvider = loc1;
            return;
        }

        /* internal  */getNimbusInfoArray(arg1: int): Array<any>
        {
            var loc5=null;
            var loc7=null;
            var loc1=[];
            var loc2=ShopConfig.instance.getShopByName(arg1);
            var loc3;
            var loc4=(loc3 = loc2.items).length;
            var loc6=0;
            while (loc6 < loc4) 
            {
                if ((loc5 = loc3[loc6]).itemInfo != null) 
                {
                    if ((loc7 = loc5.itemInfo.item).category == ECategory._ECategoryProp && loc7.type == EProp._EPropNimbusBottle && loc5.unit == EPrictUnit._EPriceUnitGold && loc7.effect > 0) 
                    {
                        loc1.push(loc5);
                    }
                }
                ++loc6;
            }
            return loc1;
        }

        /* internal */ static /* const */NormalShopCode: int=GameDefConfig.instance.getEShopCode(ShopType.Normal);

        /* internal */ static /* const */VipShopCode: int=1712;

        /* internal */ /* var */isHot: Boolean=false;
    }
